\begin{subsection}{Fórmula de Machin}

	\begin{equation*}
		\frac{\pi}{4} = 4 \; \mathrm{arctan}(1/5) - \mathrm{arctan}(1/239), \text{con } \mathrm{arctan}(x) = \sum_{n=0}^{\infty} \left(-1\right)^n \frac{x^{2n+1}}{2n+1} \quad \text{cuando } \left|x\right|<1
    \end{equation*}
	
	\pa
	
	Definimos primero el error de calcular $arctan(k)$ con $|k|<1$. Para ello definimos el error de cada uno de los términos de la sumatoria.\\
	
	Dado $n \in \N$, sea $x=k^{2n+1}$ e $y=2n+1$.\\
	
	$\e{div}{x,y,:} = \ev{x} - \ev{y} + \er{:}{x,y}$ (1).\\
	
	Como $y$ es de tipo entero (exacto) ya que $n \leq 2$ lo que implica $y \leq 5$ no hay $overflow$. Resta calcular el error de $x$.\\
	
	\underline{Analicemos el error de $x=k^y$ ($k=\frac{1}{5}$ o $k=\frac{1}{239} \Rightarrow k>0$):}\\
	
	$\e{pot}{k,y,POT} = y\ev{k} + ln(k) y\ev{y} + \er{POT}{k,y}$ (2)\\
	
	$\Rightarrow_{Reemplazando \; (2) \; en \; (1)}$\\
	
	Tenemos entonces que el error de un término de la arcotangente es:\\
	
	$y\ev{k} + ln(k) y\ev{y} + \er{POT}{k,y} - \ev{y} + \er{:}{x,y}$\\
	
	Para acotar el error de un término de la arcotangente empezamos por acotar el error de $k$.
	Sea $u=2^{1-t}$.\\
	
	\pa
	
	$\left|\ev{k}\right| = \left\{ 
	\begin{array}{l}
	\left|\ev{\frac{1}{5}}\right| \leq \left|\ev{1}\right| + \left|\ev{5}\right| + \left|\er{:}{1,5}\right| = \left|\ev{5}\right| + \left|\er{:}{1,5}\right|\\
	\left|\ev{\frac{1}{239}}\right| \leq \left|\ev{1}\right| + \left|\ev{239}\right| + \left|\er{:}{1,239}\right| = \left|\ev{239}\right| + \left|\er{:}{1,239}\right|\\
	\end{array}
	\leq 2u\\
	\right.$\\
	
	\pa
	
	Por otra parte tenemos:\\
	
	$\left|\ev{\frac{k^y}{y}}\right| \leq \left|y\ev{k}\right| + \left|ln(k)y\ev{y}\right| + \left|\er{POT}{k,y}\right| + \left|\ev{y}\right| + \left|\er{:}{x,y}\right| =$\\
	
	$(2n+1)(\left|\ev{k}\right| + \left|ln(k)\right|\left|\ev{2n+1}\right|) + \left|\er{POT}{k,(2n+1)}\right| + \left|\ev{(2n+1)}\right| + \left|\er{:}{k^{2n+1},2n+1}\right|$\\
	
	$\Rightarrow \left|\ev{\frac{k^{2n+1}}{2n+1}}\right| \leq (2n+1)(2u + \left|ln(k)\right|u) + 3u = [(2n+1)(2 + \left|ln(k)\right|) + 3]u$\\
	
	\pa
	
	Teniendo esta información, queremos realizar el análisis teórico para los primeros tres términos de la sumatoria. Para poder realizarlo, llamamos $a$ $(n=0)$ al primer término,
	$b$ $(n=1)$ al segundo y $c$ $(n=2)$ al tercero.
	
	Dado que tanto $a$ como $c$ corresponden a $n$ par son términos tal que $(-1)^n = 1$ en contraste con $b$ que tiene signo negativo. Por este motivo,\\
	tenemos que la arcotangente hasta el tercer término es: $a - b + c$.\\
	
	Analizamos primero el error cometido de realizar $a+c$.\\
	
	$\e{sum}{a,c,+} = \frac{a}{a+c}\ev{a} + \frac{c}{a+c}\ev{c} + \er{+}{a,c}$\\
	
	Analizamos ahora el error de restar el segundo término ($b$).\\
		
	$\e{restar}{a+c,b,-} = \frac{a+c}{a+c-b}\er{+}{a,c} - \frac{b}{a+c-b}\ev{b} + \er{-}{a+c,b} =$\\
	
	$\frac{a+c}{a+c-b}(\frac{a}{a+c}\ev{a} + \frac{c}{a+c}\ev{c} + \er{+}{a,c}) - \frac{b}{a+c-b}\ev{b} + \er{-}{a+c,b} =$\\
	
	$\frac{a\ev{a} + c\ev{c} - b\ev{b} + (a+c)\er{+}{a,c}}{a-b+c} + \er{-}{a+c,b} = \ev{a+c-b} = \ev{arctan_2}$\\
	
	$\left|\ev{arctan_2}\right| \leq \frac{|a||\ev{a}| + |c||\ev{c}| + |b||\ev{b}| + |a+c|\left|\er{+}{a,c}\right|}{|a-b+c|} + \left|\er{-}{a+c,b}\right|$\\
	
	\underline{Como vimos antes:}
	
	$\left|\ev{a}\right| \leq [(2 + \left|ln(k)\right|) + 3]u$
	
	$\left|\ev{b}\right| \leq [3(2 + \left|ln(k)\right|) + 3]u$
	
	$\left|\ev{c}\right| \leq [5(2 + \left|ln(k)\right|) + 3]u$\\
	
	$\Rightarrow$\\
	$\left|\ev{arctan_2(k)}\right| \leq \frac{|a|[(2 + \left|ln(k)\right|) + 3]u + |c|[5(2 + \left|ln(k)\right|) + 3]u + |b|[3(2 + \left|ln(k)\right|) + 3]u + |a+c|\left|\er{+}{a,c}\right|}{|a-b+c|} + \left|\er{-}{a+c,b}\right|$\\
	
	Para la fórmula de Machin se necesita calcular $arctan(\frac{1}{5})$ y $arctan(\frac{1}{239})$.\\
	
	$\left|\ev{arctan_2(\frac{1}{5})}\right| \leq \frac{\frac{1}{5}[(2 + 2) + 3]u + \frac{1}{5^6}[5(2 + 2) + 3]u + \frac{1}{3}\frac{1}{5^3}[3(2 + 2) + 3]u + (\frac{1}{5}+\frac{1}{5^6})\left|\er{+}{\frac{1}{5},\frac{1}{5^6}}\right|}{\frac{1}{5}-\frac{1}{3}\frac{1}{5^3}+\frac{1}{5^6}} + \left|\er{-}{\frac{1}{5}+\frac{1}{5^6},\frac{1}{3}\frac{1}{5^3}}\right| =$\\
	
	$\frac{\frac{7}{5}u + \frac{23}{5^6}u +\frac{1}{5}^2u + (\frac{1}{5} + \frac{1}{5^6})\left|\er{+}{\frac{1}{5},\frac{1}{5^6}}\right|}{\frac{1}{5} - \frac{1}{3}\frac{1}{5^3} + \frac{1}{5^6}} + \left|\er{-}{\frac{1}{5} + \frac{1}{5^6},\frac{1}{3}\frac{1}{5^3}} \right|$\\
	
	\pa
	
	$\left| \e{arctan_2}{\frac{1}{5}} \right| \leq \frac{\frac{7}{5}u + \frac{23}{5^6}u +\frac{1}{5^2}u + (\frac{1}{5} + \frac{1}{5^6})u}{\frac{1}{5} - \frac{1}{3}\frac{1}{5^3} + \frac{1}{5^6}} + u \leq 10u$\\
	
	\pa
	
	Por otro lado,\\
	
	$\left|\ev{arctan_2(\frac{1}{239})}\right| \leq \frac{\frac{1}{239}[(2 + 6) + 3]u + \frac{1}{5}\frac{1}{239^5}[5(2 + 6) + 3]u + \frac{1}{3}\frac{1}{239^3}[3(2 + 6) + 3]u + (\frac{1}{239}+\frac{1}{5}\frac{1}{239^5})\left|\er{+}{\frac{1}{239},\frac{1}{5}\frac{1}{239^5}}\right|}{\frac{1}{239}-\frac{1}{3}\frac{1}{239^3}+\frac{1}{5}\frac{1}{239^5}} + \left|\er{-}{\frac{1}{239}+\frac{1}{5}\frac{1}{239^5},\frac{1}{3}\frac{1}{239^3}}\right| =$\\
	
	$\frac{\frac{11}{239}u + \frac{43}{5}\frac{1}{239^5}u + \frac{35}{3}\frac{1}{239^3}u + (\frac{1}{239}+\frac{1}{5}\frac{1}{239^5})\left|\er{+}{\frac{1}{239},\frac{1}{5}\frac{1}{239^5}}\right|}{\frac{1}{239}-\frac{1}{3}\frac{1}{239^3}+\frac{1}{5}\frac{1}{239^5}} + \left|\er{-}{\frac{1}{239}+\frac{1}{5}\frac{1}{239^5},\frac{1}{3}\frac{1}{239^3}}\right|$\\
	
	\pa
	
	$\left|\ev{arctan_2(\frac{1}{239})}\right| \leq \frac{\frac{11}{239}u + \frac{43}{5}\frac{1}{239^5}u + \frac{35}{3}\frac{1}{239^3}u + (\frac{1}{239}+\frac{1}{5}\frac{1}{239^5})u}{\frac{1}{239}-\frac{1}{3}\frac{1}{239^3}+\frac{1}{5}\frac{1}{239^5}} + u \leq 13u$\\
	
	\pa
	
	Finalmente calculamos el error de la fórmula de Machin:
	
	\begin{equation*}
		\frac{\pi}{4} = 4 \; \mathrm{arctan}(1/5) - \mathrm{arctan}(1/239) \Rightarrow \pi = 16 \; \mathrm{arctan}(1/5) - 4 \; \mathrm{arctan}(1/239)
    \end{equation*}
	
	Tomamos $z=16arctan(\frac{1}{5})$ y $w=4arctan(\frac{1}{239})$\\
	
	$\ev{\pi} = \e{restar}{z,w,-} = \frac{z\ev{z} - w\ev{w}}{z-w} + \er{-}{z,w}$\\
	
	$\ev{z} = \e{mult}{16,arctan(\frac{1}{5}),*} = \ev{16} + \ev{arctan(\frac{1}{5})} + \er{*}{16,arctan(\frac{1}{5})}$\\
	
	$\ev{w} = \e{mult}{4,arctan(\frac{1}{239}),*} = \ev{4} + \ev{arctan(\frac{1}{239})} + \er{*}{4,arctan(\frac{1}{239})}$\\
	
	$\Rightarrow \ev{\pi} = \frac{16arctan_2(\frac{1}{5})(\ev{16} + \ev{arctan(\frac{1}{5})} + \er{*}{16,arctan(\frac{1}{5})}) - 4arctan_2(\frac{1}{239})(\ev{4} + \ev{arctan(\frac{1}{239})} + \er{*}{4,arctan(\frac{1}{239})})}{16arctan_2(\frac{1}{5})-4arctan_2(\frac{1}{239})} + \er{-}{16arctan_2(\frac{1}{5}),4arctan_2(\frac{1}{239})}$\\
	
	$\Rightarrow \left|\ev{\pi}\right| \leq \frac{16arctan_2(\frac{1}{5})(|\ev{16}| + 10u + \left|\er{*}{16,arctan(\frac{1}{5})}\right|) + 4arctan_2(\frac{1}{239})(|\ev{4}| + 13u + \left|\er{*}{4,arctan(\frac{1}{239})}\right|)}{16arctan_2(\frac{1}{5})-4arctan_2(\frac{1}{239})} + \left|\er{-}{16arctan_2(\frac{1}{5}),4arctan_2(\frac{1}{239})}\right| \leq$\\
	
	$\leq \frac{16arctan_2(\frac{1}{5})(u + 10u + u) + 4arctan_2(\frac{1}{239})(u + 13u + u)}{16arctan_2(\frac{1}{5})-4arctan_2(\frac{1}{239})} + u =$\\
	
	$(\frac{192arctan_2(\frac{1}{5}) + 60arctan_2(\frac{1}{239})}{16arctan_2(\frac{1}{5})-4arctan_2(\frac{1}{239})} + 1) u \leq 14u$\\
	
	$\left|\ev{\pi}\right| \leq 14*2^{1-t}$
	
	
\end{subsection}
